<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Index</title>
    
    
    
    
    
    <meta property="og:title" content=""/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content=""/>
    
    <meta property="og:url" content=""/>
    
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <script src="scripts/jquery.min.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="styles/jaguar.css">
    
    
    <script>
    var config = {"monospaceLinks":false,"cleverLinks":false,"applicationName":"ZangoDB","disqus":"","googleAnalytics":"","openGraph":{"title":"","type":"website","image":"","site_name":"","url":""},"meta":{"title":"","description":"","keyword":""},"linenums":true,"default":{}};
    </script>
    

    
</head>
<body>
<div id="wrap" class="clearfix">
    
<div class="navigation">
    <h3 class="applicationName"><a href="index.html">ZangoDB</a></h3>

    <div class="search">
        <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
    </div>
    <ul class="list">
    
        <li class="item" data-name="Collection">
            <span class="title">
                <a href="Collection.html">Collection</a>
                
            </span>
            <ul class="members itemMembers">
            
            <span class="subtitle">Members</span>
            
                <li data-name="Collection#name"><a href="Collection.html#name">name</a></li>
            
            </ul>
            <ul class="typedefs itemMembers">
            
            </ul>
            <ul class="methods itemMembers">
            
            <span class="subtitle">Methods</span>
            
                <li data-name="Collection#aggregate"><a href="Collection.html#aggregate">aggregate</a></li>
            
                <li data-name="Collection#find"><a href="Collection.html#find">find</a></li>
            
                <li data-name="Collection#findOne"><a href="Collection.html#findOne">findOne</a></li>
            
                <li data-name="Collection#insert"><a href="Collection.html#insert">insert</a></li>
            
                <li data-name="Collection#remove"><a href="Collection.html#remove">remove</a></li>
            
                <li data-name="Collection#update"><a href="Collection.html#update">update</a></li>
            
            </ul>
            <ul class="events itemMembers">
            
            </ul>
        </li>
    
        <li class="item" data-name="Cursor">
            <span class="title">
                <a href="Cursor.html">Cursor</a>
                
            </span>
            <ul class="members itemMembers">
            
            </ul>
            <ul class="typedefs itemMembers">
            
            </ul>
            <ul class="methods itemMembers">
            
            <span class="subtitle">Methods</span>
            
                <li data-name="Cursor#filter"><a href="Cursor.html#filter">filter</a></li>
            
                <li data-name="Cursor#forEach"><a href="Cursor.html#forEach">forEach</a></li>
            
                <li data-name="Cursor#group"><a href="Cursor.html#group">group</a></li>
            
                <li data-name="Cursor#hint"><a href="Cursor.html#hint">hint</a></li>
            
                <li data-name="Cursor#limit"><a href="Cursor.html#limit">limit</a></li>
            
                <li data-name="Cursor#project"><a href="Cursor.html#project">project</a></li>
            
                <li data-name="Cursor#skip"><a href="Cursor.html#skip">skip</a></li>
            
                <li data-name="Cursor#sort"><a href="Cursor.html#sort">sort</a></li>
            
                <li data-name="Cursor#toArray"><a href="Cursor.html#toArray">toArray</a></li>
            
                <li data-name="Cursor#unwind"><a href="Cursor.html#unwind">unwind</a></li>
            
            </ul>
            <ul class="events itemMembers">
            
            <span class="subtitle">Events</span>
            
                <li data-name="Cursor#event:data"><a href="Cursor.html#event:data">data</a></li>
            
                <li data-name="Cursor#event:end"><a href="Cursor.html#event:end">end</a></li>
            
            </ul>
        </li>
    
        <li class="item" data-name="Db">
            <span class="title">
                <a href="Db.html">Db</a>
                
            </span>
            <ul class="members itemMembers">
            
            <span class="subtitle">Members</span>
            
                <li data-name="Db#name"><a href="Db.html#name">name</a></li>
            
                <li data-name="Db#version"><a href="Db.html#version">version</a></li>
            
            </ul>
            <ul class="typedefs itemMembers">
            
            </ul>
            <ul class="methods itemMembers">
            
            <span class="subtitle">Methods</span>
            
                <li data-name="Db#close"><a href="Db.html#close">close</a></li>
            
                <li data-name="Db#collection"><a href="Db.html#collection">collection</a></li>
            
                <li data-name="Db#drop"><a href="Db.html#drop">drop</a></li>
            
                <li data-name="Db#open"><a href="Db.html#open">open</a></li>
            
            </ul>
            <ul class="events itemMembers">
            
            <span class="subtitle">Events</span>
            
                <li data-name="Db#event:blocked"><a href="Db.html#event:blocked">blocked</a></li>
            
            </ul>
        </li>
    
    </ul>
</div>
    <div class="main">
        <h1 class="page-title" data-filename="index.html">Index</h1>
        


    


    <h3> </h3>








    




    <section>
        <article class="readme"><p><img src="https://cldup.com/kvTEbzc-Sz.png" alt="ZangoDB"></p>
<p><strong>ZangoDB</strong> is a <strong>MongoDB-like</strong> interface for <strong>HTML5 IndexedDB</strong> that supports most of the familiar filtering, projection, sorting, updating and aggregation features of MongoDB, for usage in the <strong>web browser</strong>.</p>
<h2>Example</h2><pre class="prettyprint source lang-javascript"><code>let db = new zango.Db('mydb', { people: ['age'] });
let people = db.collection('people');

let docs = [
    { name: 'Frank', age: 20 },
    { name: 'Thomas', age: 33 },
    { name: 'Todd', age: 33 },
    { name: 'John', age: 28 },
    { name: 'Peter', age: 33 },
    { name: 'George', age: 28 }
];

people.insert(docs).then(() => {
    return people.find({
        name: { $ne: 'John' },
        age: { $gt: 20 }
    }).group({
        _id: { age: '$age' },
        count: { $sum: 1 }
    }).project({
        _id: 0,
        age: '$_id.age'
    }).sort({
        age: -1
    }).forEach(doc => console.log('doc:', doc));
}).catch(error => console.error(error));</code></pre><p>Which outputs:</p>
<pre class="prettyprint source"><code>doc: { count: 3, age: 33 }
doc: { count: 1, age: 28 }</code></pre><h2>Installation</h2><p><strong>ZangoDB</strong> is available as an npm package, and the web-browser build can be <a target="_blank" href="https://unpkg.com/zangodb@latest/dist/zangodb.min.js">downloaded here</a> or embedded:</p>
<pre class="prettyprint source lang-html"><code>&lt;script src=&quot;https://unpkg.com/zangodb@latest/dist/zangodb.min.js&quot;>&lt;/script></code></pre><p>For certain web browsers, such as Internet Explorer, the Babel polyfill is required and must be loaded before <strong>ZangoDB</strong>:</p>
<pre class="prettyprint source lang-html"><code>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js&quot;>&lt;/script></code></pre><p><strong>ZangoDB</strong> then can be accessed using the global variable <code>zango</code>.</p>
<p>To install <strong>ZangoDB</strong> for usage with <a target="_blank" href="https://nodejs.org/">node</a>:</p>
<pre class="prettyprint source"><code>$ npm install zangodb</code></pre><p>In both cases, an implementation of IndexedDB is required. For environments without a native implementation of IndexedDB, <a target="_blank" href="https://github.com/dumbmatter/fakeIndexedDB">Fake IndexedDB</a> can be used:</p>
<pre class="prettyprint source lang-javascript"><code>global.indexedDB = require('fake-indexeddb');
global.IDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange');</code></pre><h2>Document Language Operators</h2><h3>Filter Operators</h3><p>The following filter operators are supported: <code>$and</code>, <code>$or</code>, <code>$not</code>, <code>$nor</code>, <code>$eq</code>, <code>$ne</code>, <code>$gt</code>, <code>$gte</code>, <code>$lt</code>, <code>$lte</code>, <code>$in</code>, <code>$nin</code>, <code>$elemMatch</code>, <code>$regex</code>, and <code>$exists</code>.</p>
<h3>Expression Operators</h3><p>Expression operators can be used in combination with the group and projection operators.</p>
<p>The following expression operators are supported: <code>$literal</code>, <code>$add</code>, <code>$subtract</code>, <code>$multiply</code>, <code>$divide</code>, <code>$mod</code>, <code>$abs</code>, <code>$ceil</code>, <code>$floor</code>, <code>$ln</code>, <code>$log10</code>, <code>$pow</code>, <code>$sqrt</code>, <code>$trunc</code>, <code>$concat</code>, <code>$toLower</code>, <code>$toUpper</code>, <code>$concatArrays</code>, <code>$dayOfMonth</code>, <code>$year</code>, <code>$month</code>, <code>$hour</code>, <code>$minute</code>, <code>$second</code>, and <code>$millisecond</code>.</p>
<h3>Update Operators</h3><p>The following update operators are supported: <code>$set</code>, <code>$unset</code>, <code>$rename</code>, <code>$inc</code>, <code>$mul</code>, <code>$min</code>, <code>$max</code>, <code>$push</code>, <code>$pop</code>, <code>$pullAll</code>, <code>$pull</code>, and <code>$addToSet</code>.</p>
<h3>Group Operators</h3><p>The following group operators are supported: <code>$sum</code>, <code>$avg</code>, <code>$min</code>, <code>$max</code>, <code>$push</code>, and <code>$addToSet</code>.</p>
<h2>Aggregation Pipeline Stages</h2><p>The following aggregation pipeline stages are supported: <code>$match</code>, <code>$project</code>, <code>$group</code>, <code>$unwind</code>, <code>$sort</code>, <code>$skip</code>, and <code>$limit</code>.</p>
<h2>License</h2><p>MIT, please view the LICENSE file.</p></article>
    </section>






        

        <footer>
            Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Oct 18 2017 21:09:50 GMT-0400 (Eastern Daylight Time)
        </footer>
    </div>
</div>
<script>prettyPrint();</script>
<script src="scripts/jaguar.js"></script>
</body>
</html>